#!/bin/bash

set -e

cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1

export readonly ARCH=${1:-amd64}
export readonly NAME=${2:-$(basename "${PWD%/*}")}
export readonly VERSION=${3:-$(basename "$PWD")}

rm -rf opt
wget -qO- "https://ghproxy.cc/https://github.com/juicedata/juicefs/releases/download/v1.1.2/juicefs-1.1.2-linux-${ARCH}.tar.gz" | tar -zx "juicefs"

mkdir -p opt
mv "juicefs" ./opt
chmod a+x opt/juicefs
